import requests

url = 'https://baidu.com'

headers = {
    'User-Agent': 'xxx'
}

cookies = {
    'PHPSESSID': 'xxx'
}

# 显示使用Cookie，将cookie作为参数传入
r1 = requests.get(url, headers, cookies=cookies)

# 隐式使用Cookie，

s = requests.session()
s.headers = {
    'User-Agent': 'xxx'
}
# 添加Cookie
requests.utils.add_dict_to_cookiejar(
    s.cookies,{"PHPSESSID":"xxx"}
)
s.get(url, headers=headers)
